<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<html>
<head>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<title>我的考试</title>
	<script type="text/javascript" src="${path}/js/resource/jquery.min.js"></script>
	<script type="text/javascript" src="${path}/js/resource/bootstrap.min.js"></script>
	<script type="text/javascript" src="${path}/js/resource/icheck.js"></script>
	<link rel="stylesheet" href="${path}/css/resource/bootstrap.min.css">
	<link rel="stylesheet" href="${path}/css/resource/blue.css">
	<script type="text/javascript">
		$(document).ready(function(){
//			alert("11111111111111111111111111111111111111");
			$('input').iCheck({
				checkboxClass: 'icheckbox_square-blue',
				radioClass: 'iradio_square-blue',
				increaseArea: '20%'
			});
			$("#submitExperiment").click(function(){
					var experimentId =  $("#eId").val();
					//alert(experimentId);
					window.location.href="${ctx}/scene/sceneEnvironment/toExperimentOperateViewByEId?eId="+experimentId
				<%--console.log(${resourceQuestion.getEnvironmentId()});--%>
				<%--alert(${resourceQuestion.getEnvironmentId()});--%>
				<%--var newWin = window.open("${ctx}/scene/sceneEnvironment/toSceneExperimentOperationWait","_blank");--%>
					<%--newWin.location.href = toUrl;--%>
			})
		});

	</script>
	<style type="text/css">
		.b {
			font-weight:bold;
		}
		.infot {
			margin-left: 75px;
		}
		.iradio_square-blue {
			width: 24px;
			height: 24px;
			background: url(${path}/static/images/blue.png) no-repeat;
			background-position: -120px 0;
		}
		.icheckbox_square-blue {
			width: 24px;
			height: 24px;
			background: url(${path}/static/images/blue.png) no-repeat;
		}
		.choicea{
			font-size: 17px;
		}
		.choice{
			margin-left: 15px;
			margin-top: 10px;
			font-size: 17px;
		}
		.tborder{
			border:1px  dotted #66B3FF;
			margin-right: 300px;
			margin-left: 80px;
		}
	</style>

	<script>
		//进入实验
		function experimentOperate(resourceQuestionId)
		{
			var toUrl;
			$.ajax({
				type: "POST",
				url: "${ctx}/scene/sceneEnvironment/isExperimentExistPaper",
				data: {
					resourceQuestionId:resourceQuestionId
				},
				success: function (jsonModel) {
					var msg=jsonModel.msg;
					var instanceId=jsonModel.dataObj;
					if(msg=='2')
					{

						$.mbox({
							area: [ "450px", "auto" ], //弹框大小
							border: [ 0, .5, "#666" ],
							dialog: {
								msg: "已经存在实验，是否跳转至该课程完成实验?",
								btns: 2,   //1: 只有一个按钮   2：两个按钮  3：没有按钮 提示框
								type: 2,   //1:对钩   2：问号  3：叹号
								btn: [ "原实验", "新实验"],  //自定义按钮
								yes: function() {  //点击左侧按钮：成功
									msg='4';
									toUrl = "${ctx}/scene/sceneEnvironment/toExperimentOperateViewPaper?instanceId="+instanceId+"&msg="+msg+"&resourceQuestionId="+resourceQuestionId;
								},
								no: function() { //点击右侧按钮：失败
									msg='5';
									toUrl = "${ctx}/scene/sceneEnvironment/toExperimentOperateViewPaper?instanceId="+instanceId+"&msg="+msg+"&resourceQuestionId="+resourceQuestionId;

								}
							}
						});
					}
					else{
						toUrl = "${ctx}/scene/sceneEnvironment/toExperimentOperateViewPaper?instanceId="+instanceId+"&msg="+msg+"&resourceQuestionId="+resourceQuestionId;
					}

				},
				error:function(){
				}
			});
			var newWin = window.open("${ctx}/scene/sceneEnvironment/toSceneExperimentOperationWait","_blank");
			$.ajax().done(function() {
				// 重定向到目标页面
				newWin.location.href = toUrl;
			});

		}
	</script>
</head>
<%--lsjh--%>
<body>
<ul class="nav nav-tabs">
	<li><a href="${ctx}/resource/resourcePaper/">试卷管理</a></li>
	<li class="active"><a href="${ctx}/resource/resourcePaper/view?id=${resourcePaper.id}">试卷预览</a></li>
</ul><br/>
<form:form id="inputForm" modelAttribute="resourcePaper" action="${ctx}/resource/resourcePaper/view" method="post" class="form-horizontal">

<div class="container-fluid">
	<div class="row">
		<div class="col-md-10">
			<div class="row">
				<div class="col-md-5 col-md-offset-2">
					<h3 class="b">试卷名称：${resourcePaper.paperName}</h3>
				</div>
				<div class="col-md-4">
					<h3 class="infot b">总分：${resourcePaper.totalScore}</h3>
				</div>
			</div>



			<!-- 单选题 -->
			<div class="row">
				<div class="col-md-2  col-md-offset-1" >
					<h4 class="b">一、单选题</h4>
				</div>
				<div class="col-md-2  col-md-offset-1">
					<c:set var="indexRadio" value="0" />
					<c:forEach var="resourceQuestion" items="${resourceQuestionListRadio}">
						<c:if test="${resourceQuestion.questionType == '0' }">
						<c:set var="indexRadio" value="${indexRadio+1}" />
					</c:if>
					</c:forEach>

					<h4 class="b">题目数量：${indexRadio}</h4>
				</div>
				<div class="col-md-2  col-md-offset-1">
					<h4 class="b">每题分值：

						<c:if test="${resourcePaper.paperType == '1'}">
						<c:if test="${resourceQuestionListRadio!=null&&fn:length(resourceQuestionListRadio)!=0}">${resourceQuestionListRadio[0].questionScore}</c:if></h4>
					</c:if>

					<c:if test="${resourcePaper.paperType == '2'}">
						<c:if test="${resourcePaper.radioScore!=null}">${resourcePaper.radioScore}</c:if></h4>
					</c:if>

				</div>
			</div>
			<div class="col-md-offset-1" style="padding-left: 15px;">
					<c:set var="index" value="0" />
					<c:forEach var="resourceQuestion" items="${resourceQuestionListRadio}">
						<div class="choicea">
							<input type="hidden" id="eId" value=${resourceQuestion.getEnvironmentId()} />
							<c:if test="${resourceQuestion.questionType == '0' }">
								<c:if test="${resourceQuestion.getEnvironmentId() !=null && !resourceQuestion.getEnvironmentId().equals('')}">
								</c:if>
								<c:set var="index" value="${index+1}" />
								${index}、${resourceQuestion.stem}
								<c:if test="${resourceQuestion!=null&&resourceQuestion.environmentId!=null&&resourceQuestion.environmentId!=''}">
									<a style="" href="javascript:experimentOperate('${resourceQuestion.id}')">进入实验</a>
								</c:if>
									<div class="choice" >
										<input type="radio" name="il"> A、${resourceQuestion.option.optionA}
									</div>
									<div class="choice" >
										<input type="radio" name="il"> B、${resourceQuestion.option.optionB}
									</div>
									<div class="choice" >
										<input type="radio" name="il"> C、${resourceQuestion.option.optionC}
									</div>
									<div class="choice" >
										<input type="radio" name="il"> D、${resourceQuestion.option.optionD}
									</div>
								<br>
							</c:if>
						</div>
					</c:forEach>
			</div>
			<!-- 多选题 -->
			<div class="row">
				<div class="col-md-2  col-md-offset-1">
					<h4 class="b">二、多选题</h4>
				</div>
				<div class="col-md-2 col-md-offset-1">
					<c:set var="indexCheckbox" value="0" />
					<c:forEach var="resourceQuestion" items="${resourceQuestionListCheckbox}">
						<c:if test="${resourceQuestion.questionType == '1' }">
						<c:set var="indexCheckbox" value="${indexCheckbox+1}" />
						</c:if>
				</c:forEach>
					<h4 class="b">题目数量：${indexCheckbox}</h4>
				</div>
				<div class="col-md-2 col-md-offset-1">
					<h4 class="b">每题分值：
						<c:if test="${resourcePaper.paperType == '1'}">
						<c:if test="${resourceQuestionListCheckbox!=null&&fn:length(resourceQuestionListCheckbox)!=0}">${resourceQuestionListCheckbox[0].questionScore}</c:if>
						</c:if>

						<c:if test="${resourcePaper.paperType == '2'}">
						<c:if test="${resourcePaper.checkboxScore !=null}">${resourcePaper.checkboxScore}</c:if></h4>
					</c:if>

					</h4>
				</div>
			</div>
			<div class="col-md-offset-1" style="padding-left: 30px;">
					<c:set var="index" value="0" />
					<c:forEach var="resourceQuestion" items="${resourceQuestionListCheckbox}">
						<div class="row choicea">
								<%--<c:set var="index" value="${index+1}" />--%>
							<c:if test="${resourceQuestion.questionType == '1' }">
								<c:set var="index" value="${index+1}" />
								${index}、${resourceQuestion.stem}
								<c:if test="${resourceQuestion!=null&&resourceQuestion.environmentId!=null&&resourceQuestion.environmentId!=''}">
									<a style="" href="javascript:experimentOperate('${resourceQuestion.id}')">进入实验</a>
								</c:if>
								<%--<div class="row ">--%>

									<div class="choice" >
										<input type="checkbox" name="il"> A、${resourceQuestion.option.optionA}
									</div>
									<div class="choice" >
										<input type="checkbox" name="il"> B、${resourceQuestion.option.optionB}
									</div>
									<div class="choice" >
										<input type="checkbox" name="il"> C、${resourceQuestion.option.optionC}
									</div>
									<div class="choice" >
										<input type="checkbox" name="il"> D、${resourceQuestion.option.optionD}
									</div>
								<%--</div>--%>
								<br>
							</c:if>
						</div>
					</c:forEach>
				</div>

			<!-- 判断题 -->
			<div class="row">
				<div class="col-md-2 col-md-offset-1">
					<h4 class="b">三、判断题</h4>
				</div>
				<div class="col-md-2 col-md-offset-1">
					<c:set var="indexJudement" value="0" />
					<c:forEach var="resourceQuestion" items="${resourceQuestionListJudement}">
						<c:if test="${resourceQuestion.questionType == '2' }">
							<c:set var="indexJudement" value="${indexJudement+1}" />
						</c:if>
					</c:forEach>
					<h4 class="b">题目数量：${indexJudement}</h4>
				</div>
				<div class="col-md-2 col-md-offset-1">


					<h4 class="b">每题分值：
						<c:if test="${resourcePaper.paperType == '1'}">
							<c:if test="${resourceQuestionListJudement!=null&&fn:length(resourceQuestionListJudement)!=0}">${resourceQuestionListJudement[0].questionScore}</c:if>
						</c:if>
						<c:if test="${resourcePaper.paperType == '2'}">
							<c:if test="${resourcePaper.judementScore !=null}">${resourcePaper.judementScore}</c:if>
						</c:if>
					</h4>

				</div>
			</div>
			<div class="col-md-offset-1" style="padding-left: 30px;">
					<c:set var="index" value="0" />
					<c:forEach var="resourceQuestion" items="${resourceQuestionListJudement}">
						<%--<div class="choicea">--%>
							<%--<c:if test="${resourceQuestion.questionType == '2' }">--%>
							<%--<c:set var="index" value="${index+1}" />--%>
							<%--${index}、${resourceQuestion.stem}--%>

								<%--<div class="choice" >--%>
									<%--<input type="radio" name="ic"> A、${resourceQuestion.option.optionA}--%>
								<%--</div>--%>
								<%--<div class="choice" >--%>
									<%--<input type="radio" name="ic"> B、${resourceQuestion.option.optionB}--%>
								<%--</div>--%>


							<%--</c:if>--%>
						<%--</div>--%>
						<div class="choicea">
							<c:if test="${resourceQuestion.questionType == '2' }">
								<c:set var="index" value="${index+1}" />
								${index}、${resourceQuestion.stem}
								<c:if test="${resourceQuestion!=null&&resourceQuestion.environmentId!=null&&resourceQuestion.environmentId!=''}">
									<a style="" href="javascript:experimentOperate('${resourceQuestion.id}')">进入实验</a>
								</c:if>
								<div class="choice" >
									<input type="radio" name="ic"> A、${resourceQuestion.option.optionA}
								</div>
								<div class="choice" >
									<input type="radio" name="ic"> B、${resourceQuestion.option.optionB}
								</div>
								<br>

							</c:if>
						</div>
					</c:forEach>
				</div>

			<!-- 简答题 -->
			<div class="row">
				<div class="col-md-2  col-md-offset-1">
					<h4 class="b">四、简答题</h4>
				</div>
				<div class="col-md-2 col-md-offset-1">
					<c:set var="indexShortAnswer" value="0" />
					<c:forEach var="resourceQuestion" items="${resourceQuestionListShortAnswer}">
						<c:if test="${resourceQuestion.questionType == '3' }">
							<c:set var="indexShortAnswer" value="${indexShortAnswer+1}" />
						</c:if>
					</c:forEach>
					<h4 class="b">题目数量：${indexShortAnswer}</h4>
				</div>
				<div class="col-md-2 col-md-offset-1">
					<h4 class="b">每题分值：
						<c:if test="${resourcePaper.paperType == '1'}">
							<c:if test="${resourceQuestionListShortAnswer!=null&&fn:length(resourceQuestionListShortAnswer)!=0}">${resourceQuestionListShortAnswer[0].questionScore}</c:if>
						</c:if>
						<c:if test="${resourcePaper.paperType == '2'}">
						<c:if test="${resourcePaper.shortAnswerScore !=null}">${resourcePaper.shortAnswerScore}</c:if></h4>
					</c:if>
				</h4>
				</div>
			</div>
			<div class="col-md-offset-1" style="padding-left: 30px;">
					<c:set var="index" value="0" />
					<c:forEach var="resourceQuestion" items="${resourceQuestionListShortAnswer}">
						<div class="row  choicea">
							<c:if test="${resourceQuestion.questionType == '3' }">
								<c:set var="index" value="${index+1}" />
								${index}、${resourceQuestion.stem}
								<c:if test="${resourceQuestion!=null&&resourceQuestion.environmentId!=null&&resourceQuestion.environmentId!=''}">
									<a style="" href="javascript:experimentOperate('${resourceQuestion.id}')">进入实验</a>
								</c:if>
									<div>
										<textarea style="width:500px;height:200px;padding-left: 15px;margin-top: 15px"></textarea>
									</div>

								<br>
							</c:if>
						</div>
					</c:forEach>
				</div>


		</div>


	</div>
	<div class="form-actions">
		<input id="btnCancel" class="btn col-md-offset-10" type="button" value="返 回" onclick="history.go(-1)"/>
	</div>
	</form:form>
</body>
</html>